﻿using SmartCity.BasicData.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace SmartCity.BasicData.Repo
{
    // created by FuMingJun
    /// <summary>
    /// 仓储接口
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IBaseRepository<T> where T : BaseEntity
    {
        //增
        Task<int> CreateAsync (T entity);
        //改
        Task<int> UpdateAsync (T entity); 
        //查单个
        Task<T>  GetModelAsync(long id);
        Task<List<T>> GetAllAsync();
        Task<List<T>> GetAsync(Expression<Func<T,bool>> expression);

        //查询表达式
        /// <summary>
        /// 返回 IQueryable<T>  ,这个返回并不是结果,而是表达式
        /// </summary>
        /// <returns></returns>
        Task<IQueryable<T>> QueryAllAsync();

    }
}
